import axios from '@/libs/api.request'

// 添加消费
export const addExpense = (data) => {
  return axios.request({
    url: '/admin/consumption/add',
    data,
    method: 'post'
  })
}

// 删除消费
export const deleteExpense = (id) => {
  return axios.request({
    url: `/admin/consumption/delete/${id}`,
    method: 'get'
  })
}

// 消费列表
export const expenseList = (data) => {
  return axios.request({
    url: `/admin/consumption/pageList`,
    data,
    method: 'post'
  })
}

// 消费统计
export const expenseHistory = (data) => {
  return axios.request({
    url: `/admin/consumption/history/total/${data}`,
    method: 'get'
  })
}

// 查询本周每天的消费统计
export const totalWeek = (data) => {
  return axios.request({
    url: `/admin/consumption/total/week`,
    method: 'get'
  })
}

// 查询本年每月的消费统计
export const totalYear = (data) => {
  return axios.request({
    url: `/admin/consumption/total/year`,
    method: 'get'
  })
}

// 获取当前用户的会员卡列表
export const getMemberCard = (memberId) => {
  return axios.request({
    url: `/admin/card/member/select/${memberId}`,
    method: 'get'
  })
}

// 导出列表
export const exportExpense = (data) => {
  return axios.requestExcelt({
    url: `/admin/excel/consumptionList/export`,
    data,
    method: 'post'
  })
}
